package com.bilgeadam.exceptions.program;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Scanner;

/**
 * 
 * @author Bora SAYINER
 * @since Nov 30, 2014 10:21:03 AM
 * @version 1.0.0
 */
public class Driver {

	public static void main(String[] args) throws FileNotFoundException, IOException {
		// int sayi1 = 0;
		// int sayi2 = 0;
		// Scanner scanner = new Scanner(System.in);
		// try {
		// sayi1 = scanner.nextInt();
		// sayi2 = scanner.nextInt();
		// System.out.println(sayi1 / sayi2);
		// } catch (InputMismatchException exception) {
		// System.out.println("Lütfen bir sayı giriniz.");
		// } catch (ArithmeticException exception) {
		// System.out.println("0'dan farklı bir sayı giriniz.");
		// } catch (Exception e) {
		// e.printStackTrace();
		// }

		// int sayi1 = promptNumeric("Lütfen 1. sayiyi giriniz: ");
		// int sayi2 = promptNumeric("Lütfen 2. sayiyi giriniz: ");
		// System.out.println(sayi1 + sayi2);

		// Employee employee = new Employee();
		// employee.setFirstName("Ko");
		//
		// employee.setLastName("ALTINDAŞ");
		// System.out.println(employee.toString());

		// try {
		//
		// } catch (Exception e) {
		//
		// } finally {
		//
		// }

		// File file = new File("/home/developer/Desktop/test");
		// FileReader fileReader = null;
		// try {
		// fileReader = new FileReader(file);
		// int c = 0;
		// while (c != -1) {
		// try {
		// c = fileReader.read();
		// System.out.print((char) c);
		// } catch (IOException e) {
		// e.printStackTrace();
		// }
		// }
		// } catch (FileNotFoundException e) {
		// e.printStackTrace();
		// } finally {
		// if (fileReader != null) {
		// try {
		// fileReader.close();
		// } catch (Exception e2) {
		//
		// }
		// }
		// }
		//
		// FileReader fileReader = null;
		// try {
		// fileReader = new FileReader(new
		// File("/home/developer/Desktop/test"));
		// int c = 0;
		// while ((c = fileReader.read()) != -1) {
		// System.out.print((char) c);
		// }
		// } catch (ArithmeticException | InputMismatchException | IOException
		// exception) {
		// exception.printStackTrace();
		// } finally {
		// try {
		// if (fileReader != null) fileReader.close();
		// } catch (Exception e2) {
		// e2.printStackTrace();
		// }
		// }

		// try {
		// int result = 6 / 0;
		// System.out.println("In try");
		// System.out.println(result);
		// } catch (InputMismatchException exception) {
		// exception.printStackTrace();
		// } catch (ArithmeticException e) {
		// e.printStackTrace();
		// } catch (Exception e) {
		// System.out.println("In catch");
		// } finally {
		// System.out.println("In finally");
		// }

		// try (FileReader fileReader = new FileReader(new
		// File("/home/developer/Desktop/test"))) {
		// StringBuilder builder = new StringBuilder();
		// int c = 0;
		// while ((c = fileReader.read()) != -1) {
		// builder.append((char) c);
		// }
		// System.out.println(builder.toString());
		// }

	

	}

	private static int promptNumeric(String message) {
		int sayi = 0;
		boolean isExceptionOccured = false;

		do {
			Scanner scanner = null;
			try {
				System.out.print(message);
				scanner = new Scanner(System.in);
				sayi = scanner.nextInt();
				isExceptionOccured = false;
			} catch (Exception e) {
				isExceptionOccured = true;
			}
			scanner.close();
		} while (isExceptionOccured);
		return sayi;
	}
}
